package com.neuronbit.businessflow.intellij.psi;

import com.intellij.lang.findUsages.FindUsagesProvider;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * The type Simple find usages provider.
 */
public class SimpleFindUsagesProvider implements FindUsagesProvider {
//    @Nullable
//    @Override
//    public WordsScanner getWordsScanner() {
//        BpmLexer lexer = new BpmLexer(null);
//        Lexer adaptor = new ANTLRLexerAdaptor(BpmLanguage.INSTANCE, lexer);
//        return new DefaultWordsScanner(adaptor,
//                ParserDefinition.STRING,
//                ParserDefinition.COMMENTS,
//                TokenSet.EMPTY);
//    }

    @Override
    public boolean canFindUsagesFor(@NotNull PsiElement psiElement) {
        return psiElement instanceof PsiMethod && ((PsiMethod) psiElement).getName().equals("execute");
    }

    @Nullable
    @Override
    public String getHelpId(@NotNull PsiElement psiElement) {
        return null;
    }

    @NotNull
    @Override
    public String getType(@NotNull PsiElement element) {
//        if (element instanceof SimpleProperty) {
//            return "simple property";
//        }
        return "method";
    }

    @NotNull
    @Override
    public String getDescriptiveName(@NotNull PsiElement element) {
//        if (element instanceof SimpleProperty) {
//            return ((SimpleProperty) element).getKey();
//        }
        return "execute";
    }

    @NotNull
    @Override
    public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
//        if (element instanceof SimpleProperty) {
//            return ((SimpleProperty) element).getKey() +
//                    SimpleAnnotator.SIMPLE_SEPARATOR_STR +
//                    ((SimpleProperty) element).getValue();
//        }
        return "execute";
    }

}
